Eight-limb Montgomery field arithmetic for 255-bit moduli (Pasta) - #274
Conversation
🤖 PR Summary
Proven eight-limb Montgomery field arithmetic for 255-bit moduli, instantiated on the Pasta curves (Pallas/Vesta), with a zero-import runtime definitions module for native compilation. The PR also refactors the existing BabyBear and KoalaBear fast field implementations to use a shared 32-bit Montgomery library, consolidates NTT domain structures, and updates documentation and benchmarks. No new Statistics
Lean Declarations ✏️ Removed: 150 declaration(s)
✏️ Added: 320 declaration(s)
…and 170 more not listed. ✏️ Affected: 2 declaration(s) (line number changed)
📄 **Per-File Summaries**
Last updated: 2026-07-26 07:01 UTC. |
|
hey @mitschabaude - just checking if this is ready for a review? |
|
@graikos can you fix conflicts to make review easier? |
|
awesome, thanks @mitschabaude ! |
bddc016 to
444947f
Compare
🤖 PR Summary
This PR adds the Pasta field instantiation and a scalar FFT module, building on the existing eight-limb Montgomery arithmetic. The new contributions are: primality certificates for the two 255-bit Pasta primes, fast Montgomery field instances for Pallas and Vesta, a zero-import runtime FFT over Montgomery residues, and the corresponding import, test, and documentation updates. Statistics
Lean Declarations ✏️ Added: 27 declaration(s)
📋 **Additional Analysis**The diff adds Pasta (Pallas/Vesta) fields, a scalar FFT implementation, and tests. A few minor violations of the CompPoly style guide were identified, predominantly in the test file. 📄 **Per-File Summaries**
Last updated: 2026-09-02 15:50 UTC. |
…tation Add `Fields/Pasta`, the per-field facade for the Pallas and Vesta base fields, following the KoalaBear layering: * `Pasta/Basic.lean` — the two 255-bit primes with Pratt primality certificates (ported from the certificates by Daira-Emma Hopwood, using CompPoly's own `PrattCertificate` infrastructure), their `Fact` and `Field` instances, and the 2-cycle abbreviations relating each curve's scalar field to the other's base field; * `Pasta/Fast.lean` — the `Mont64x8Field` constants for both fields and the namespaced `Pallas.Fast` / `Vesta.Fast` API over the shared eight-limb implementation, with the canonical-field bridge; * `Pasta.lean` — the facade re-exporting both. `Mont64x8Field` moves from the raw layer to `Montgomery/Native64x8Field` alongside the carrier it parameterizes, mirroring `Mont32Field` in `Montgomery/Native32Field`, and now carries `prime` like its single-word counterpart, so the bridge no longer takes a separate `Fact` argument. Tests cross-check both fast fields against canonical `ZMod` arithmetic for powers and inverses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
444947f to
37685bc
Compare
|
@mitschabaude just lmk when it's ready for review :) |
Summary
This PR is now rebased onto
mainand contains only the work that remains after the shared eight-limb Montgomery stack landed in #284.Montgomery.Native64x8.FastFieldimplementation, with the standardofFieldandringEquivAPI.Montgomery/ScalarFft.lean, an in-place radix-2 DIT FFT over eight-limb Montgomery residues and precomputed twiddles.Runtime layout
ScalarFftimports onlyNative64x8Defs. This keeps its fullprecompileModulesimport closure free of Mathlib, matching the downstream Ironwood verifier-key certificate that uses this arithmetic for its MSM and FFT. The FFT module currently contains runtime definitions only; its correctness proof remains downstream until it is upstreamed separately.Validation
lake buildlake test./scripts/check-imports.sh./scripts/lint-style.shpython3 ./scripts/check-docs-integrity.pyAll required CI checks are green.